<td><input type="checkbox" name="id[]" id="ck_{$vo.id}" onclick="single(this)" value="{$vo.id}"></td>
{if !isset($unp)}
<td>{$vo.id|high_light=$Request.param.id}</td>
<td>{$vo.group_id|high_light=$Request.param.group_id}</td>
<td>
    <a title="详细资料" href="javascript:;" onclick="driverInfo({$vo.driver_user_id})" style="text-decoration:none">
<!--查询司机的用户名-->
    {php}
        if(!empty($vo['driver_user_id'])){
            $user_name = Db::name('admin_user')->where('id',$vo['driver_user_id'])->value('realname');
            if($user_name){
                echo $user_name;
            }else{
                echo '用户信息不存在';
            }
        }else{
            echo $vo['driver_user_id'];
        }
    {/php}
    </a>
</td>
<td>
    {php}
    if(!empty($vo['driver_user_id'])){
        $mobile = Db::name('admin_user')->where('id',$vo['driver_user_id'])->value('mobile');
        if($mobile){
            echo $mobile;
        }else{
            echo '用户信息不存在';
        }
    }else{
        echo $vo['driver_user_id'];
    }
    {/php}
</td>
<td>
    {php}
        if(!empty($vo['group_id'])){
            $productName = Db::name('dispatch_traveler_group')->where('id',$vo['group_id'])->value('title');
            if($productName){
                echo $productName;
            }else{
                echo '不存在产品名称';
            }
        }else{
            echo $vo['group_id'];
        }
    {/php}
</td>
<td>
    {php}
        if(!empty($vo['group_id'])){
            $dispatchStatus = Db::name('dispatch_traveler_group')->where('id',$vo['group_id'])->value('dispatch_group_status');
            switch($dispatchStatus){
                case 'accounts': echo '已结算'; break;
                case 'achieve': echo '已完成'; break;
                case 'proceed': echo '进行中'; break;
                case 'sendorders': echo '已派单'; break;
                case 'undistributed': echo '未分配'; break;
                default: echo '未分配';
            }
        }else{
            echo $vo['group_id'];
        }
    {/php}
</td>
<td>
    <!--从订单旅客表获取订单id，在从订单表获取旅游id，最后去路线表获取旅游路线名称-->
    {php}
        if(!empty($vo['group_id'])){
            $findTraveler = Db::name('order_traveler')->where('group_id',$vo['group_id'])->order('id','desc')->find();
            if(!$findTraveler){
                echo '不存在订单旅客数据';
            }else{
                $oid = $findTraveler['oid'];
                $route_id = Db::name('order')->where('id',$oid)->value('route_id');
                if($route_id){
                    $routeName = Db::name('route')->where('id',$route_id)->value('title');
                    if($routeName){
                        echo $routeName;
                    }else{
                        echo '不存在该旅游路线';
                    }
                }else{
                    echo '未选择旅游路线';
                }
            }
        }else{
            echo $vo['group_id'];
        }
    {/php}
</td>
<td>{$vo.number_of_guests}</td>
<td>
{php}
    if(!empty($vo['departure_date'])) {
        echo date('Y-m-d',$vo['departure_date']);
    }
{/php}
</td>
<td>{$vo.car_form|high_light=$Request.param.car_form}</td>
<td>{$vo.remark|high_light=$Request.param.remark}</td>
{else}
<td>
    {php}
    if(!empty($vo['group_id'])){
        $route_id = Db::name('dispatch_traveler_group')->where('id',$vo['group_id'])->value('route_id');
        echo Db::name('route')->where('id',$route_id)->value('title');
    }
    {/php}
</td>
<td>{$vo.group_id|high_light=$Request.param.group_id}</td>
<td>
    <a title="详细资料" href="javascript:;" onclick="driverInfo({$vo.driver_user_id})" style="text-decoration:none">
        <!--查询司机的用户名-->
        {php}
        if(!empty($vo['driver_user_id'])){
        $user_name = Db::name('admin_user')->where('id',$vo['driver_user_id'])->value('realname');
        if($user_name){
        echo $user_name;
        }else{
        echo '用户信息不存在';
        }
        }else{
        echo $vo['driver_user_id'];
        }
        {/php}
    </a>
</td>
<td>{$vo.number_of_guests}</td>
<td>
    {php}
    if(!empty($vo['departure_date'])) {
    echo date('Y-m-d',$vo['departure_date']);
    }
    {/php}
</td>
<td>
    {php}
    if(!empty($vo['finish_date'])) {
    echo date('Y-m-d',$vo['finish_date']);
    }
    {/php}
</td>
<td>{$vo.remark|high_light=$Request.param.remark}</td>
{/if}
<script>
    function driverInfo(driver_user_id) {
        var url = '/admin/portion_traveler/details';
        if (!driver_user_id){
            layer.msg('缺少必要的参数');
        }
        $.ajax({
            type: 'get',
            url: url,
            data:{ driver_user_id: driver_user_id },
            success: function (data) {
                if (data.code == 1){
                    layer.msg(data.msg)
                    return false
                }else{
                    layer_open('详细资料','/admin/portion_traveler/details/driver_user_id/'+driver_user_id,{w:'1300px',h:'750px'})
                }
            }
        })
    }
</script>